package com.ddw.meedeeuh.shared.mvp;

import com.ddw.meedeeuh.MeedeeuhApp;

public abstract class PresenterBase<V extends View> implements Presenter<V> {

	private final V view;
	private final MeedeeuhApp app;

	public PresenterBase(MeedeeuhApp app, V view) {
		if(app == null) {
			throw new IllegalArgumentException("The app parameter cannot be null");
		}
		if(view == null) {
			throw new IllegalArgumentException("The view parameter cannot be null");
		}

		this.view = view;
		this.app = app;
	}

	@Override
	public MeedeeuhApp getApp() {
		return this.app;
	}

	@Override
	public V getView() {
		return this.view;
	}

	public Presenter<V> setup() {
		onSetup();
		return this;
	}

	public abstract void onSetup();

}
